import { EntityObject } from './../utils/@tiny/indexedDB/index';

interface OrderProducer {
    id: string;
    name: string;
}

/**
 * 
 * @interface Modifier
 */
export interface Modifier {
    name: string;
    options: [any];
}

/**
 * 购物车
 * @interface KDSCartItem
 */
export interface Orderitem {
    id: string;
    qty: number;
    inventoryCode: string;
    inventoryId: string;
    inventoryName: string;
    modifiers?: Modifier[];
    categories?: Category[];
    beginTime?: number;//开始制作时间
    finishTime?: number;//单项完成时间
    deliverTime?: number;//出品时间
    createTime?: number;//出品时间
    user?: { id: string; name: string }
    description?: string;
    //最后一次催菜时间
    remindTime?: number;
    //总催菜次数
    remindCount?: number;
    //退菜数量
    refundQty?: number;
    extended: OrderExtended;
    isLocalStall: Boolean;
    producerId: string;
    producer: OrderProducer;
    animationState: string;//动画状态
    expediteQty: number; // 已出品的数量
    pickup: "" | "waiting" | "pickup";
    type?:"" | "closed" | "canceled";
}

export interface OrderExtended {
    table:{
        id:string;
        name:string;
        zone:{
            id:string;
            name:string;
        }
    }
}

export interface Category {
    id: string;
    name: string;
    parent: Category;
}



export class Order extends EntityObject<Order>{
    id: string;
    orderId: string;
    serialNo: string;
    items: Orderitem[];
    description?: string;
    createTime: number;
    extended: OrderExtended;
    customerIdentity: string;
    terminalId: string;
    //下单时间
    receiveTime: number;
    beginTime: number;
    //完成时间
    finishTime?: number;
    stall: string;
    canFinish?: Boolean; //厨房单完成
    canAllFinish?: Boolean //整单完成
    terminalName: string;


    //前端model
    hasDeliverCount: number;//已经出品的
    notHasDeliverCount: number;//没有出品的
}